/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BLL;
import DAL.KhachHangDAL;
import DTO.KhachHang;
import java.sql.SQLException;
import java.util.ArrayList;
/**
 *
 * @author Huong Giang
 */
public class KhachHangBLL {


    public static boolean insertKH(KhachHang emp) {
        boolean result = false;
        if (KhachHangDAL.checkKHByCMT((emp.getCmt()))) {
            result = false;
        } else {
           result = KhachHangDAL.insertKH(emp);
        }
        return result;
    }

    public static boolean deleteKH(int cmt) {
        if (KhachHangDAL.checkKHByCMT(cmt)) {
            return KhachHangDAL.deleteKH(cmt);
        } else {
            return false;
        }
    }

    public static boolean updateKH(KhachHang emp) {
        if (KhachHangDAL.checkKHByCMT(emp.getCmt())) {
            return KhachHangDAL.updateKH(emp);
        } else {
            return false;
        }
    }

       public static ArrayList<KhachHang> selectKHall() {
        return KhachHangDAL.selectKHall();
    }
    
    public static ArrayList<KhachHang> searchKHByCMT(int cmt){
        return KhachHangDAL.searchKHByCMT(cmt);
    }
    public static boolean deleteKH(String cmt) throws SQLException {
       if(KhachHangDAL.deleteKH(cmt))
       {
           return true;
       }else
           return false;
    }
}

